using UnityEngine;
using UnityEngine.Events;

namespace Utility.GameEvents.Scriptable.Integrated {
    public class VoidGameEventListener : MonoBehaviour, Core.IGameEventListener<Void> {
        [SerializeField] private VoidGameEvent gameEvent;
        [SerializeField] private UnityEvent response;

        private void OnEnable() => gameEvent?.Register(this);
        private void OnDisable() => gameEvent?.Unregister(this);

        public void OnEventRaised(Void _) => response?.Invoke();

        public void Raise() => gameEvent?.Raise();
    }
}